package test01;

// Pipeline.java - 连接过滤器的管道
public class Pipeline {
    private Filter[] filters;

    public Pipeline(Filter... filters) {
        this.filters = filters;
    }

    public Object execute(Object input) {
        Object result = input;
        for (Filter filter : filters) {
            result = filter.process(result);
            if (result == null) {
                break;
            }
        }
        return result;
    }
}